#ifndef PICTUREPROCESS_H
#define PICTUREPROCESS_H

#include"Thread.h"
#include"Background.h"
/**
INFO:
	to process picture get the plate number
Author:
	Mark on 2014/4/8
	<mark199312@gmail.com>
*/

#define PICMARGINERROR 20


class PictureProcess : public Thread
{
public:
	vector<Mat> pP;
	Background bG;
	int pW;
	int pH;

	PictureProcess(std::string tName="No name") : Thread(tName){};

	~PictureProcess();

	void addPicture(Mat &p);

	void setBG(Background bG);

	vector<Mat> getPP();

	void eraseBackground(Mat &m);
	void eraseTop(double percentage,Mat &m);

	bool inMarginOfError(int a,int b,int marginError=PICMARGINERROR);

	void eraseRed(Mat &m);


	void convertToGray(Mat &p);
	void brightnessExpend(Mat &p);

	void threshold(Mat &p);
	void gradientSharp(Mat &p);

	void mediaFilter(Mat &p);

	void topValue(Mat &p);


	void display()
	{
		namedWindow("picutre", WINDOW_NORMAL);
		imshow( "picutre",this->pP[0]); 
	}

	void save(Mat m)
	{
		imwrite("output.bmp",m);
	}

	void run();
};
#endif